package plus.ldl.ldltest.mapper;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import plus.ldl.ldltest.pojo.User;

import java.util.List;

/**
 * @author ldl.plus
 * @date 2020年04月27日  19:20
 */
@Mapper
@Repository
public interface UserMapper {

    @Select("select * from springboot.user")
    List<User> findAll();

    @Insert("insert into springboot.user(username, password) VALUES (#{username} ,#{password} )")
    void add(User user);

    @Delete("delete from springboot.user where id=#{id} ")
    void deleteById(Integer id);

    @Update("update springboot.user set username=#{username} ,password=#{password} where id=#{id} ")
    void updateById(User user);
}
